<? 
	session_start();
	require('config.php');
	$admin_name=$_POST['admin_name'];
	$admin_password=$_POST['password'];
	$conn=mysql_connect($host,$user,$password);
	mysql_select_db($db);
	mysql_query("SET NAMES UTF8");
	$exec="select password from vote_users where admin_name='$admin_name'";
	$result=mysql_query($exec);
	if ($rs=@mysql_fetch_object($result))
	{
		if ($rs->password==$admin_password)
		{
			$_SESSION['admin']="OK";
			echo "<script language='javascript'>alert('Logged in !');window.location.href='admin.php';</script>";
		}
		else
		{
			echo "<script language='javascript'>alert('The password is WRONG');history.go(-1);</script>";
			exit;
		}
	}
	else
	{
		echo "<script language='javascript'>alert('The User is not existed');history.go(-1);</script>";
		exit;
	}

	mysql_close();
?>
